package com.google.samples.apps.library_common.extension


/**
 * Created by Administrator on 2020/12/22 0022.
 * Describe:
 */

fun String.getDouble(): Double {
    try {
        return toDouble()
    } catch (e: Exception) {
        return 0.00
    }
}
fun String.getInt(): Int {
    try {
        return toInt()
    } catch (e: Exception) {
        return 0
    }
}
fun String.getFloat(): Float {
    try {
        return toFloat()
    } catch (e: Exception) {
        return 0f
    }
}


/**
 * 密码至少包含 数字和英文，长度6-20
 */
var passwordReg1 = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$"

/**
 * 密码包含 数字,英文,字符中的两种以上，长度6-20
 */
var passwordReg2 = "^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)])+$).{6,20}$"

/**
 * 至少包含数字跟字母，可以有字符
 */
var passwordReg3 = "(?=.*([a-zA-Z].*))(?=.*[0-9].*)[a-zA-Z0-9-*/+.~!@#$%^&*()]{6,20}$"
